#ifndef PROTOCOL_H
#define PROTOCOL_H

/*
 * This File describes communication between the moderator, workers
 * and themselves.
 */

#define INIT     0
/*
 * Initialization arrays. These are used to pass the map to each node
 * !!The first element of each array is the length of the array!!
 *
 * NODES passes an array of nodes owned by that worker
 * The array is structed with an int that can be converted
 * to a character to represent the node name, followed by
 * the index of the first node that it connects to found in WEIGHTS.
 * -------------
 * |A:I|B:I|C:I|
 * -------------
 */
#define NODES    1
/*
 * WEIGHTS is an array for the connections of the own nodes
 * The array is structured with an int either with an index
 * found in NODES followed by the weight to travel there
 * or a -1 followed by an index found in EXTERNAL.
 * --------------
 * |I:W|I:W|-1:I|
 * --------------
 */
#define WEIGHTS  2
/*
 * EXTERNAL is the owner of the node not own by this worker
 * The array is structed with an int that can be converted
 * to a character to represent the node name, followed by
 * an int for the worker that owns that node, followed by 
 * the weight to travel there.
 * -------------------
 * |A:P:W|B:P:W|C:P:W|
 * -------------------
 */
#define EXTERNAL 3

/*
 * NW: Node Weight sent by workers to workers to report traversal
 *     weight to a node. Struced with node name followed by weight
 *     followed by who it came from.
 * -------
 * |A:W:O|
 * -------
 */
#define NW 4

/*
 * DONE: Sent when worker finishes traversing all nodes.
 * UNDONE: Sent when worker is retraversing a new section 
 *         after sending DONE.
 * FINALIZE: Sent to workers by moderator when recieves 
 *           DONE from everyone.
 * REPORT: Sent to workers by moderator when everyone 
 *         confirms DONE after FINALIZE.
 * REPORTSIZE: Sent by the workers to inform the size
 *         of the report to be sent.
 */
#define DONE     5
#define UNDONE   6
#define FINALIZE 7
#define REPORT   8
#define REPORTSIZE   9

#define DEBUG 0

#endif
